<%@page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<div class="page-sidebar-wrapper">
	<div class="page-sidebar navbar-collapse collapse">
		<ul id="draw_first_index" class="page-sidebar-menu" data-keep-expanded="false" data-auto-scroll="true" data-slide-speed="200">
			
		</ul>
	</div>
</div>
<script type="text/javascript">
$.ajax({
	type:"POST",
	url:"<%=request.getContextPath()%>/menu",
	data: {
		
	},
	dataType :'json',
	timeout:"20000",
	success:function(data,textStatus){
		var code = data.code;
		var json = data.data;
		var htm = '<li class="sidebar-toggler-wrapper"> <div class="sidebar-toggler"></div> </li><li class="sidebar-search-wrapper">&nbsp;</li>';
		for(var a in json){
			var node = json[a];
			var f_name = node.name;
			var f_css = node.css;
			var fathernode = '<li id="__businessMenu" class="active open"><a href="javascript:;"> <i class="'+f_css+'"></i> <span class="title">'+f_name+'</span> <span id="__businessMenuSpan" class="arrow open"></span></a><ul class="sub-menu">';
			var cds = node.childs;
			for(var b in cds){
				var child = cds[b];
				var c_name = child.name;
				var hasrole = child.hasRole;
				var c_css = child.css;
				if(hasrole!=null){
					var childnode = '<shiro:hasRole name="admin"><li id="_leftMenu_'+child.id+'"><a href="'+child.href+'"> <i class="'+c_css+'"></i> '+c_name+'</a></li></shiro:hasRole>';
				}else{
					var childnode = '<li id="_leftMenu_'+child.id+'"><a href="'+child.href+'"> <i class="'+c_css+'"></i> '+c_name+'</a></li>';
				}
				fathernode = fathernode + childnode;
			}
			fathernode = fathernode + "</ul></li>"
			htm = htm + fathernode;
		}
		$("#draw_first_index").html(htm);
		var menuid = <%=request.getAttribute("menuid")%>;
		$("#_leftMenu_" + menuid).addClass("active");
	},
	error : function(XMLResponse) {
		alert("提交超时请检查网络环境");
	}
});	
</script>